unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  TPointArray = array [1..4] of TPoint;

type
  TForm1 = class(TForm)
    function circumgyrate(arr : TPointArray):TPointArray;
    procedure FormCreate(Sender: TObject);
    procedure FormPaint(Sender: TObject);

  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  A, B : TPointArray;

implementation

{$R *.dfm}

function TForm1.circumgyrate(arr: TPointArray): TPointArray;
var
  i, x, y : integer;
  HalfAlfa : real;
begin
  HalfAlfa := 360/14;
  for i := 1 to 4 do
  begin
    x := arr[i].X;
    y := arr[i].Y;
    arr[i].X := trunc( Cos(HalfAlfa)*x - Sin(HalfAlfa)*y );
    arr[i].Y := trunc( Sin(HalfAlfa)*x + Cos(HalfAlfa)*y );
    arr[i].X := arr[i].X + 200;
    arr[i].Y := arr[i].Y +200;
  end;
  //Canvas.Polyline( [ arr[1], arr[2], arr[3], arr[4], arr[1] ] );

  Result := arr;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Canvas.Pen.Width := 1;
  Canvas.Pen.Color := clblue;
end;

procedure TForm1.FormPaint(Sender: TObject);
begin
  A[1] := Point(200,200);
  A[2] := Point(200,300);
  A[3] := Point(300,300);
  A[4] := Point(300,200);
  Canvas.Polyline( [ A[1], A[2], A[3], A[4], A[1] ] );
  B[1] := Point(0,0);
  B[2] := Point(0,100);
  B[3] := Point(100,100);
  B[4] := Point(100,0);
  B := circumgyrate(B);
  Canvas.Polyline( [ b[1], b[2], b[3], b[4], b[1] ] );
end;

end.
